	var myRs=new Array(), selectItem;
	var selectPart=0;
	function compare(a,b){
		return parseInt(a[1]) - parseInt(b[1]);
	}
	function InsertItem(s){
		myRs[myRs.length++] = s.split(/,/);
	}

	function ExCloItem(){
		var c,e=event.srcElement, p=e.parentElement.children
		if(e.myHref!=''){
			eval((e.myTarget!=''?e.myTarget:e.target)+'.location.href='+'e.myHref'); //要改成?接到某?只需把alert改成eval即可
		}
		if(selectItem!=null){
			selectItem.className='NoSelect';
		}
		e.className='SelectEd';
		selectItem=event.srcElement;
		if(c=document.all(e.value)){
			p[0].src=(c.style.display=='none'?'../images/treeview/Opended.gif':'../images/treeview/closed.gif');
			c.style.display=(c.style.display=='none'?'block':'none');
		}
		else{
			p[0].src='../images/treeview/new.gif';
		}
			selectPart=e.value;

	}
	function ExCloItem2(){
		var c,e=event.srcElement, p=e.parentElement.children
		if(c=document.all(p[1].value)){
			e.src=(c.style.display=='none'?'../images/treeview/Opended.gif':'../images/treeview/closed.gif');
			c.style.display=(c.style.display=='block'?'none':'block');
		}
		else{
			e.src='../images/treeview/new.gif';
		}
	}
	function OutItem(){
		var e=event.srcElement
		if(selectItem != ''){
			e.className=(selectItem==e?'SelectEd':'NoSelect');
		}
		else{
			e.className='NoSelect';
		}
	}
	function ChkExist(n){
		//n=parseInt(n);
		var i=0;
		for(i=0;i<myRs.length;i++){
			if(n==myRs[i][1]){
				return true;
			}
		}
		return false;
	}
	function drawTree(n){
		
		if(n==0){
			myRs.sort(compare);
		}

		if (ChkExist(n)!=true){
				return;
		}
		
		document.write('<div id="'+n+'" style="cursor:hand;'+(n!=0?'position:relative;padding-left:20px;display:none;':'')+'">');
		for(var i=0;i<myRs.length;i++){
			if (myRs[i][1]==n){
				document.write('<div style="margin:7px;"><img src='+(ChkExist(myRs[i][0])?"../images/treeview/closed.gif":"../images/treeview/new.gif" )+' onclick="ExCloItem2()" align="absmiddle" />');
				document.write('<span onclick="ExCloItem()" target="'+ myRs[i][4] +'" myHref="'+(myRs[i].length>3?myRs[i][3]:'')+'" myTarget="' + (myRs[i].length>4?myRs[i][4]:'') +'" value="'+myRs[i][0]+'" class="NoSelect" onmouseout="OutItem()" onmouseover="this.className=\'SelectIng\'">'+myRs[i][2]+'</span></div>');
				drawTree(myRs[i][0]);
			}
		}
		document.write('</div>');
	}